package com.bkgy.modular.tborderthkalert.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bkgy.modular.tbmodelset.entity.TbModelSet1720;
import com.bkgy.modular.tborderthkalert.dao.TbOrderThkAlertDao;
import com.bkgy.modular.tborderthkalert.entity.TbOrderThkAlert;
import com.bkgy.modular.tborderthkalert.service.TbOrderThkAlertService;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author:Lipeng Zhao
 * Description:
 *
 * @Date:Created In 15:39 2025/11/4
 */
@Service
public class TbOrderThkAlertServiceImpl extends ServiceImpl<TbOrderThkAlertDao, TbOrderThkAlert> implements TbOrderThkAlertService {

    @Autowired
    private TbOrderThkAlertDao tbOrderThkAlertDao;

    /**
     * 分页查看记录
     * @param jsonObject 分页参数字符串
     */
    public ResultData findByCondition(JSONObject jsonObject) {
        try {
            JSONObject condition = jsonObject.getJSONObject("condition");

            List<TbOrderThkAlert> list = tbOrderThkAlertDao.findByCondition(condition);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("查询失败,失败信息为" + e.getMessage(), null);
        }
    }

    public ResultData findDataByCondition(JSONObject jsonObject) {
        try {
            JSONObject condition = jsonObject.getJSONObject("condition");

            List<TbOrderThkAlert> list = tbOrderThkAlertDao.findDataByCondition(condition);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("查询失败,失败信息为" + e.getMessage(), null);
        }
    }

    public ResultData findCal1630DataByCondition(JSONObject jsonObject) {
        try {
            JSONObject condition = jsonObject.getJSONObject("condition");

            List<TbOrderThkAlert> list = tbOrderThkAlertDao.findCal1630DataByCondition(condition);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("查询失败,失败信息为" + e.getMessage(), null);
        }
    }

    public ResultData findCGLDataByCondition(JSONObject jsonObject) {
        try {
            JSONObject condition = jsonObject.getJSONObject("condition");

            List<TbOrderThkAlert> list = tbOrderThkAlertDao.findCGLDataByCondition(condition);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("查询失败,失败信息为" + e.getMessage(), null);
        }
    }
}
